package com.wjj.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.wjj.constants.StudentConstants;
import com.wjj.dao.constants.CollectionConstants;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author junjun Wang
 * @Date Create in 23:36 2023/12/6
 **/
@Component
@Slf4j
public class MybatisMetaObjectHandler implements MetaObjectHandler {

	@Override
	public void insertFill(MetaObject metaObject) {
		log.info("start insert fill ....");
		this.strictInsertFill(metaObject, StudentConstants.CREATE_TIME, Date.class, new Date());
		this.strictInsertFill(metaObject, StudentConstants.UPDATE_TIME, Date.class, new Date());
	}

	@Override
	public void updateFill(MetaObject metaObject) {
		this.strictUpdateFill(metaObject, StudentConstants.UPDATE_TIME, Date.class, new Date());
	}

}
